package com.kingsoft.labs.tangram.util.http;

import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

public class HttpHelper {
	public static Map<String, String> parseParam(String raw) {
		HashMap<String, String> map = new HashMap<String, String>();
		StringTokenizer st = new StringTokenizer(raw, "&");
		int idx = -1;
		String str = null;
		while (st.hasMoreTokens()) {
			str = st.nextToken();
			idx = str.indexOf('=');
			if (-1 == idx) {
				map.put(str, "");
			} else {
				map.put(str.substring(0, idx), str.substring(idx + 1));
			}
			
		}
		return map;
	}
	
	public static void main(String[] args) {
		parseParam("type=WRITE&&&filename=file0");
	}
}
